using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._ImageAnalystTools._ClassificationandPatternRecognition
{
    /// <summary>
    /// <para>Train Random Trees Regression Model</para>
    /// <para>Models the relationship between explanatory variables (independent variables) and a target dataset (dependent variable).</para>
    /// <para>对解释变量（自变量）和目标数据集（因变量）之间的关系进行建模。</para>
    /// </summary>    
    [DisplayName("Train Random Trees Regression Model")]
    public class TrainRandomTreesRegressionModel : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public TrainRandomTreesRegressionModel()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_in_rasters">
        /// <para>Input Rasters</para>
        /// <para>The single-band, multidimensional, or multiband raster datasets, or mosaic datasets, containing explanatory variables.</para>
        /// <para>包含解释变量的单波段、多维或多波段栅格数据集或镶嵌数据集。</para>
        /// </param>
        /// <param name="_in_target_data">
        /// <para>Target Raster or Points</para>
        /// <para>The point feature class containing the data that will be modeled using the explanatory variables.</para>
        /// <para>包含将使用解释变量进行建模的数据的点要素类。</para>
        /// </param>
        /// <param name="_out_regression_definition">
        /// <para>Output Regression Definition File</para>
        /// <para>A JSON format file with an .ecd extension that contains attribute information, statistics, or other information for the classifier.</para>
        /// <para>扩展名为 .ecd 的 JSON 格式文件，其中包含分类器的属性信息、统计信息或其他信息。</para>
        /// </param>
        public TrainRandomTreesRegressionModel(List<object> _in_rasters, object _in_target_data, object _out_regression_definition)
        {
            this._in_rasters = _in_rasters;
            this._in_target_data = _in_target_data;
            this._out_regression_definition = _out_regression_definition;
        }
        public override string ToolboxName => "Image Analyst Tools";

        public override string ToolName => "Train Random Trees Regression Model";

        public override string CallName => "ia.TrainRandomTreesRegressionModel";

        public override List<string> AcceptEnvironments => ["cellSize", "extent", "geographicTransformations", "outputCoordinateSystem", "scratchWorkspace", "workspace"];

        public override object[] ParameterInfo => [_in_rasters, _in_target_data, _out_regression_definition, _target_value_field, _target_dimension_field, _raster_dimension, _out_importance_table, _max_num_trees, _max_tree_depth, _max_samples, _average_points_per_cell.GetGPValue()];

        /// <summary>
        /// <para>Input Rasters</para>
        /// <para>The single-band, multidimensional, or multiband raster datasets, or mosaic datasets, containing explanatory variables.</para>
        /// <para>包含解释变量的单波段、多维或多波段栅格数据集或镶嵌数据集。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Rasters")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public List<object> _in_rasters { get; set; }


        /// <summary>
        /// <para>Target Raster or Points</para>
        /// <para>The point feature class containing the data that will be modeled using the explanatory variables.</para>
        /// <para>包含将使用解释变量进行建模的数据的点要素类。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Target Raster or Points")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_target_data { get; set; }


        /// <summary>
        /// <para>Output Regression Definition File</para>
        /// <para>A JSON format file with an .ecd extension that contains attribute information, statistics, or other information for the classifier.</para>
        /// <para>扩展名为 .ecd 的 JSON 格式文件，其中包含分类器的属性信息、统计信息或其他信息。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Regression Definition File")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _out_regression_definition { get; set; }


        /// <summary>
        /// <para>Target Value Field</para>
        /// <para>The field name of the information to model in the target point feature class or raster dataset.</para>
        /// <para>目标点要素类或栅格数据集中要建模的信息的字段名称。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Target Value Field")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _target_value_field { get; set; } = null;


        /// <summary>
        /// <para>Target Dimension Field</para>
        /// <para>A date field or numeric field in the input point feature class that defines the dimension values.</para>
        /// <para>输入点要素类中用于定义维度值的日期字段或数值字段。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Target Dimension Field")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _target_dimension_field { get; set; } = null;


        /// <summary>
        /// <para>Raster Dimension</para>
        /// <para>The dimension name of the input multidimensional raster (explanatory variables) that links to the dimension in the target data.</para>
        /// <para>链接到目标数据中维度的输入多维栅格（解释变量）的维度名称。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Raster Dimension")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _raster_dimension { get; set; } = null;


        /// <summary>
        /// <para>Output Importance Table</para>
        /// <para>A table containing information describing the importance of each explanatory variable used in the model. A larger number indicates the corresponding variable is more correlated to the predicted variable and will contribute more in prediction. Values range between 0 and 1, and the sum of all the values equals 1.</para>
        /// <para>一个表格，其中包含描述模型中使用的每个解释变量的重要性的信息。数字越大，表示相应的变量与预测变量的相关性越高，在预测中的贡献就越大。值的范围介于 0 和 1 之间，所有值的总和等于 1。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Importance Table")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _out_importance_table { get; set; } = null;


        /// <summary>
        /// <para>Max Number of Trees</para>
        /// <para>The maximum number of trees in the forest. Increasing the number of trees will lead to higher accuracy rates, although this improvement will level off. The number of trees increases the processing time linearly. The default is 50.</para>
        /// <para>森林中的最大树数。增加树的数量将导致更高的准确率，尽管这种改进将趋于平稳。树的数量线性增加处理时间。默认值为 50。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Max Number of Trees")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public long _max_num_trees { get; set; } = 50;


        /// <summary>
        /// <para>Max Tree Depth</para>
        /// <para>The maximum depth of each tree in the forest. Depth determines the number of rules each tree can create, resulting in a decision. Trees will not grow any deeper than this setting. The default is 30.</para>
        /// <para>森林中每棵树的最大深度。深度决定了每棵树可以创建的规则数量，从而做出决策。树木不会长得比这个设置更深。默认值为 30。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Max Tree Depth")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public long _max_tree_depth { get; set; } = 30;


        /// <summary>
        /// <para>Max Number of Samples</para>
        /// <para>The maximum number of samples that will be used for the regression analysis. A value that is less than or equal to 0 means that the system will use all the samples from the input target raster or point feature class to train the regression model. The default value is 10,000.</para>
        /// <para>将用于回归分析的最大样本数。小于或等于 0 的值表示系统将使用输入目标栅格或点要素类中的所有样本来训练回归模型。默认值为 10,000。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Max Number of Samples")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public long _max_samples { get; set; } = 100000;


        /// <summary>
        /// <para>Average Points Per Cell</para>
        /// <para><xdoc>
        ///   <para>Specifies whether the average will be calculated when multiple training points fall into one cell. This parameter is applicable only when the input target is a point feature class.
        ///   <bulletList>
        ///     <bullet_item>Unchecked—All points will be used when multiple training points fall into a single cell. This is the default.  </bullet_item><para/>
        ///     <bullet_item>Checked—The average value of the training points within a cell will be calculated.  </bullet_item><para/>
        ///   </bulletList>
        ///   </para>
        ///   <bulletList>
        ///     <bullet_item>Keep all points—All points will be used when multiple training points fall into a single cell. This is the default.</bullet_item><para/>
        ///     <bullet_item>Average points per cell—The average value of the training points within a cell will be calculated.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        /// <para>指定当多个训练点落入一个单元格时是否计算平均值。仅当输入目标为点要素类时，此参数才适用。
        ///   <bulletList>
        ///     <bullet_item>未选中—当多个训练点落入单个像元时，将使用所有点。这是默认设置。 </bullet_item><para/>
        ///     <bullet_item>选中—将计算像元内训练点的平均值。</bullet_item><para/>
        ///   </bulletList>
        ///   </para>
        ///   <bulletList>
        ///     <bullet_item>保留所有点—当多个训练点落入单个像元时，将使用所有点。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>每个像元的平均点—将计算像元内训练点的平均值。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Average Points Per Cell")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _average_points_per_cell_value _average_points_per_cell { get; set; } = _average_points_per_cell_value._false;

        public enum _average_points_per_cell_value
        {
            /// <summary>
            /// <para>AVERAGE_POINTS_PER_CELL</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("AVERAGE_POINTS_PER_CELL")]
            [GPEnumValue("true")]
            _true,

            /// <summary>
            /// <para>KEEP_ALL_POINTS</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("KEEP_ALL_POINTS")]
            [GPEnumValue("false")]
            _false,

        }

        public TrainRandomTreesRegressionModel SetEnv(object cellSize = null, object extent = null, object geographicTransformations = null, object outputCoordinateSystem = null, object scratchWorkspace = null, object workspace = null)
        {
            base.SetEnv(cellSize: cellSize, extent: extent, geographicTransformations: geographicTransformations, outputCoordinateSystem: outputCoordinateSystem, scratchWorkspace: scratchWorkspace, workspace: workspace);
            return this;
        }

    }

}